home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Borland Visual dBASE Professiona v7.0
/
DATA1.CAB
/
Sample_dBASE
/
Fish.wfm
< prev
next >
Wrap
Text File
|
1997-11-20
|
18KB
|
729 lines
//--------------------------------------------------------------
//
// Fish.wfm -- Fish of the World
//
// This SDI data entry form demonstrates how to call
// rowset methods from VCR style navigation buttons
// and popup menu options.
//
// Dependencies: FISH.DBF
// SHORE.JPG
// Visual Speller ActiveX
//
// Visual dBASE Samples Group
//
// $Revision: 1.20 $
//
// Copyright (c) 1997, Borland International, Inc.
// All rights reserved.
//
//---------------------------------------------------------------
set talk off
set ldCheck off
** END HEADER -- do not remove this line
//
// Generated on 11/01/97
//
parameter bModal
local f
f = new FISHFORM()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class FISHFORM of FORM
with (this)
onClose = class::FORM_ONCLOSE
open = class::FORM_OPEN
readmodal = class::FORM_READMODAL
scaleFontSize = 8
scaleFontBold = false
height = 17.4
left = 10
top = 0
width = 79.3333
text = "Visual FishBase 2.0"
background = 'filename "shore.jpg"'
autoCenter = true
mdi = false
endwith
this.SESSIONFISH = new SESSION()
this.SESSIONFISH.parent = this
with (this.SESSIONFISH)
left = 0
top = 0
lockRetryInterval = 0
endwith
this.VDBSAMPLE1 = new DATABASE()
this.VDBSAMPLE1.parent = this
with (this.VDBSAMPLE1)
left = 4
top = 0
databaseName = "VDBSAMPLE"
session = form.SESSIONFISH
active = true
endwith
this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 8
top = 0
database = form.vdbsample1
sql = 'SELECT ID, Name, Species, Fish."Length CM", Description, Fish."OLE Graphic" from "fish.dbf" Fish'
active = true
endwith
this.ENTRYID = new ENTRYFIELD(this)
with (this.ENTRYID)
enabled = false
height = 1
left = 41
top = 3
width = 9.5
metric = 0
dataLink = form.fish1.rowset.fields["ID"]
picture = "99999999"
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.ENTRYNAME = new ENTRYFIELD(this)
with (this.ENTRYNAME)
height = 1
left = 41
top = 4
width = 30
metric = 0
dataLink = form.fish1.rowset.fields["Name"]
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.ENTRYSPECIES = new ENTRYFIELD(this)
with (this.ENTRYSPECIES)
height = 1
left = 41
top = 5
width = 30
metric = 0
dataLink = form.fish1.rowset.fields["Species"]
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.SPIN_CM = new SPINBOX(this)
with (this.SPIN_CM)
onChange = class::SPIN_CM_ONCHANGE
height = 1
left = 41
top = 6
width = 10
metric = 0
dataLink = form.fish1.rowset.fields["Length CM"]
picture = "999.99"
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
endwith
this.SPIN_INCHES = new SPINBOX(this)
with (this.SPIN_INCHES)
onChange = class::SPIN_INCHES_ONCHANGE
height = 1
left = 58
top = 6
width = 10
metric = 0
picture = "999.99"
colorHighLight = ""
rangeMax = 100
rangeMin = 1
fontName = "MS Sans Serif"
fontSize = 8
value = 1
validRequired = true
borderStyle = 7
endwith
this.BOOKFISH = new NOTEBOOK(this)
with (this.BOOKFISH)
onOpen = {; this.cursel := 1}
height = 9
left = 28
top = 7.5
width = 50
metric = 0
colorNormal = "BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
dataSource = 'ARRAY {"OLE Graphic","Description"}'
borderStyle = 5
endwith
this.BOOKFISH.EDITORDESC = new EDITOR(this.BOOKFISH)
with (this.BOOKFISH.EDITORDESC)
height = 6.75
left = 1
top = 1.4
width = 46.5
metric = 0
fontName = "MS Sans Serif"
fontSize = 8
dataLink = parent.parent.fish1.rowset.fields["Description"]
cuaTab = true
pageno = 2
popupEnable = false
endwith
this.BOOKFISH.OLEGRAPHIC = new OLE(this.BOOKFISH)
with (this.BOOKFISH.OLEGRAPHIC)
height = 6.8
left = 7
top = 1.3
width = 34
metric = 0
dataLink = parent.parent.fish1.rowset.fields["OLE Graphic"]
border = false
endwith
this.SPEEDADD = new PUSHBUTTON(this)
with (this.SPEEDADD)
onClick = {||class::rowAdd( this.form )}
height = 1.5
left = 4
top = 3.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_APPEND"
fontSize = 8
speedTip = "Add Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDDELETE = new PUSHBUTTON(this)
with (this.SPEEDDELETE)
onClick = {||class::rowDelete( this.form )}
height = 1.5
left = 10
top = 3.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_DELETE"
fontSize = 8
speedTip = "Delete Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDSAVE = new PUSHBUTTON(this)
with (this.SPEEDSAVE)
onClick = {||class::rowSave( this.form )}
height = 1.5
left = 4
top = 5.5
width = 5
text = " "
metric = 0
upBitmap = "RESOURCE:2 PS_SAVE"
fontSize = 8
speedTip = "Save Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDABANDON = new PUSHBUTTON(this)
with (this.SPEEDABANDON)
onClick = {||class::rowAbandon( this.form )}
height = 1.5
left = 10
top = 5.5
width = 5
text = " "
metric = 0
upBitmap = "RESOURCE:2 PS_ABANDON"
fontSize = 8
speedTip = "Abandon Changes"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDFIND = new PUSHBUTTON(this)
with (this.SPEEDFIND)
onClick = class::SPEEDFIND_ONCLICK
height = 1.5
left = 4
top = 7.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_LOCATE"
fontSize = 8
speedTip = "Find Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDFIRST = new PUSHBUTTON(this)
with (this.SPEEDFIRST)
onClick = {||class::goFirst(this.form)}
enabled = false
height = 1.5
left = 4
top = 9.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_FIRST"
fontSize = 8
speedTip = "First Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDPREV = new PUSHBUTTON(this)
with (this.SPEEDPREV)
onClick = {||this.form.goPrev( this.form )}
enabled = false
height = 1.5
left = 10
top = 9.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_PREV"
fontSize = 8
speedTip = "Previous Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDNEXT = new PUSHBUTTON(this)
with (this.SPEEDNEXT)
onClick = {||this.form.goNext( this.form )}
height = 1.5
left = 4
top = 11.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_NEXT"
fontSize = 8
speedTip = "Next Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDLAST = new PUSHBUTTON(this)
with (this.SPEEDLAST)
onClick = {||this.form.goLast( this.form )}
height = 1.5
left = 10
top = 11.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE:2 PS_LAST"
fontSize = 8
speedTip = "Last Fish"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.SPEEDSPELL = new PUSHBUTTON(this)
with (this.SPEEDSPELL)
onClick = class::SPEEDSPELL_ONCLICK
height = 1.5
left = 4
top = 13.5
width = 5
text = " "
metric = 0
speedBar = true
upBitmap = "RESOURCE #36"
fontSize = 8
speedTip = "Check Spelling"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.LABELID = new TEXT(this)
with (this.LABELID)
height = 1
left = 29
top = 3
width = 11
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "Fish ID:"
endwith
this.LABELCOMMONNAME = new TEXT(this)
with (this.LABELCOMMONNAME)
height = 1
left = 29
top = 4
width = 11
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "Name:"
endwith
this.LABELSPECIES = new TEXT(this)
with (this.LABELSPECIES)
height = 1
left = 29
top = 5
width = 11
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "Species:"
endwith
this.LABELLENGTH = new TEXT(this)
with (this.LABELLENGTH)
height = 1
left = 29
top = 6
width = 11
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "Length:"
endwith
this.LABELCM = new TEXT(this)
with (this.LABELCM)
height = 1
left = 52
top = 6
width = 4
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "CM"
endwith
this.LABELINCHES = new TEXT(this)
with (this.LABELINCHES)
height = 1
left = 69
top = 6
width = 10
metric = 0
colorNormal = "BtnText"
alignVertical = 1
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
fontBold = true
text = "Inches"
endwith
this.VSPELL1 = new ACTIVEX(this)
with (this.VSPELL1)
height = 1
left = -10
top = 0.5
width = 4
metric = 0
license = ""
state = ""
classId = ""
endwith
this.TITLETEXT = new TEXT(this)
with (this.TITLETEXT)
height = 1.85
left = 25
top = 0.4737
width = 53
metric = 0
colorNormal = "BtnText"
alignVertical = 1
alignHorizontal = 1
transparent = true
fontSize = 12
text = "<H1>Fish of the World</H1>"
endwith
this.rowset = this.fish1.rowset
function goFirst( thisForm )
thisForm.rowset.first()
class::setNavOptions( thisForm )
return ( not thisForm.rowset.endOfSet )
function setNavOptions( thisForm )
local bFirst, bLast
bFirst = thisForm.rowset.atFirst()
bLast = thisForm.rowset.atLast()
with ( thisForm )
SPEEDFIRST.enabled := ( not bFirst )
SPEEDPREV.enabled := ( not bFirst )
SPEEDNEXT.enabled := ( not bLast )
SPEEDLAST.enabled := ( not bLast )
endwith
with ( thisForm.shortcut )
popFIRST.enabled := ( not bFirst )
popPREV.enabled := ( not bFirst )
popNEXT.enabled := ( not bLast )
popLAST.enabled := ( not bLast )
endwith
class::refreshInches( thisForm )
return
function goLast( thisForm )
thisForm.rowset.last()
class::setNavOptions( thisForm )
return ( not thisForm.rowset.endOfSet )
function goNext( thisForm )
thisForm.rowset.next(1)
if ( thisForm.rowset.endOfSet )
thisForm.rowset.next(-1)
endif
class::setNavOptions( thisForm )
return ( not thisForm.rowset.endOfSet )
function goPrev( thisForm )
thisForm.rowset.next(-1)
if ( thisForm.rowset.endOfSet )
thisForm.rowset.next(1)
endif
class::setNavOptions( thisForm )
return ( not thisForm.rowset.endOfSet )
// {Linked Method} form.onClose
function Form_OnClose
with ( this )
SPIN_INCHES.onChange := null
SPIN_CM.onChange := null
endwith
CLOSE PROCEDURE fish.pop
return true
// {Linked Method} form.open
function form_open
class::form_prepare()
return ( FISHFORM::open() )
// {Linked Method} form.readmodal
function form_readModal()
class::form_prepare()
return ( FISHFORM::readModal() )
function form_prepare
SET PROCEDURE TO "fish.pop" ADDITIVE
this.popupMenu = new fishPopup(this,"SHORTCUT")
this.SPIN_INCHES.value := (this.SPIN_CM.value / 2.54)
// If NT try to load visual speller.
if ( "NT" $ OS() )
this.VSPELL1.classID := "{97F4CED0-9103-11CE-8385-524153480001}"
endif
// Hide spell check button if activeX not present
this.speedSpell.visible := ;
( TYPE("this.VSPELL1.nativeObject.standardDictionary") == "C" )
return( this.speedSpell.visible )
function refreshInches ( thisForm )
thisForm.SPIN_INCHES.value := ( thisForm.SPIN_CM.value / 2.54)
return ( thisForm.SPIN_INCHES.value )
function rowAbandon ( thisForm )
local bAbandon
bAbandon = false
if ( thisForm.rowset.state == 5 )
bAbandon := thisForm.rowset.abandon()
class::toggleFind( false )
else
bAbandon := thisForm.rowset.abandon()
endif
return ( bAbandon )
function rowSave( thisForm )
return ( thisForm.rowset.save() )
function rowAdd( thisForm )
return ( thisForm.rowset.beginAppend() )
function rowDelete( thisForm )
local bDelete
bDelete = false
if ( MSGBOX("You are about to delete the current fish." ;
+ CHR(13) ;
+ "Click Yes to delete the current fish.", ;
"Visual FishBase", ;
4) == 6 )
bDelete := thisForm.rowset.delete()
class::goPrev( thisForm )
endif
thisForm.setFocus()
return ( bDelete )
// {Linked Method} form.speedfind.onClick
function SPEEDFIND_OnClick
local bFound
bFound = false
if ( this.form.rowset.state == 5 )
this.form.spin_inches.enabled := true
bFound := this.form.rowset.applyLocate()
if ( not bFound )
this.form.rowset.first()
MSGBOX("Fish not found.","Visual FishBase")
this.form.setFocus()
endif
class::toggleFind( false )
class::refreshInches( this.form )
else
with ( this.form.spin_inches )
value := null
enabled := false
endwith
this.form.rowset.beginLocate()
class::toggleFind( true )
endif
return ( bFound )
function toggleFind( bFind )
if ( bFind )
this.form.SPEEDFIND.upBitmap := "RESOURCE:2 PS_RUN"
else
this.form.SPEEDFIND.upBitmap := "RESOURCE:2 PS_LOCATE"
endif
with ( this.form )
SPEEDADD.enabled := ( NOT bFind )
SPEEDDELETE.enabled := ( NOT bFind )
SPEEDABANDON.enabled := ( bFind )
SPEEDFIRST.enabled := ( NOT bFind )
SPEEDPREV.enabled := ( NOT bFind )
SPEEDNEXT.enabled := ( NOT bFind )
SPEEDLAST.enabled := ( NOT bFind )
endwith
with ( this.form.shortcut )
popADD.enabled := ( NOT bFind )
popDELETE.enabled := ( NOT bFind )
popABANDON.enabled := ( bFind )
popFIRST.enabled := ( NOT bFind )
popPREV.enabled := ( NOT bFind )
popNEXT.enabled := ( NOT bFind )
popLAST.enabled := ( NOT bFind )
endwith
return (bFind)
// {Linked Method} form.speedspell.onClick
function SPEEDSPELL_OnClick
local eDesc, vSpell
eDesc = this.form.bookfish.editorDesc
vSpell = this.form.VSpell1.nativeObject
this.form.bookfish.curSel := 2
eDesc.setFocus()
vSpell.clearCounts := 1
vSpell.checkText := eDesc.value // open spell dialog
eDesc.datalink.value := vSpell.text
eDesc.datalink.parent.parent.refreshControls()
return ( true )
// {Linked Method} form.spin_cm.onChange
function SPIN_CM_OnChange
this.form.SPIN_INCHES.value = (this.value / 2.54)
return ( this.form.SPIN_INCHES.value )
// {Linked Method} form.spin_inches.onChange
function SPIN_INCHES_OnChange
this.form.SPIN_CM.value = (this.value * 2.54)
return ( this.form.SPIN_CM.value )
endclass